import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'

Vue.config.productionTip = false

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
/*
在父组件中给子组件绑定自定义事件，子组件中使用emit触发父组件给子组件绑定的自定义事件
父组件：
  <template>
  <div id="app">
    <h1>我是父组件子组件传递过来的数据是：{{ count }}</h1>
    <son @changeCount="changeCount"></son>
  </div>
</template>
<script>
import son from "@/components/son.vue";
export default {
  name: "App",
  data() {
    return {
      count: 0,
    }
  },
  methods: {
    changeCount(value) {
      this.count = value
    }
  },
  components: {
    son,
  }
}
</script>

子组件：
  <script>
  export default {
    name: "son",
    data() {
      return {
        count: 0
      }
    },
    methods: {
      handler() {
        this.count++
        this.$emit("changeCount",this.count)
      }
    }
  }
  </script>

  <template>
    <section>
      <h1>我是子组件我的数据是：{{ count }}</h1>
      <button @click="handler">+1</button>
    </section>
  </template>
*/